package cn.wjee.gradle.oss;


import cn.wjee.gradle.oss.config.OssExtConfig;
import cn.wjee.gradle.oss.task.PublishOssTask;
import org.gradle.api.Plugin;
import org.gradle.api.Project;

/**
 * PublishOss File Plugin, Base on Qiniu Cloud
 *
 * @author listening
 */
public class PublishOssPlugin implements Plugin<Project> {
    @Override
    public void apply(Project project) {
        project.getExtensions().create("oss", OssExtConfig.class);

        project.afterEvaluate(pj -> {
            OssExtConfig config = pj.getExtensions().getByType(OssExtConfig.class);
            pj.getTasks().create("publishOss", PublishOssTask.class, config);
        });
    }

}
